#pragma once

#include <gofcl_timer_r.h>

typedef struct {
	u16_s CH0EN : 1;
	u16_s CH0P : 1;
	u16_s CH0NEN : 1;
	u16_s CH0NP : 1;
	u16_s CH1EN : 1;
	u16_s CH1P : 1;
	u16_s CH1NEN : 1;
	u16_s CH1NP : 1;
	u16_s CH2EN : 1;
	u16_s CH2P : 1;
	u16_s CH2NEN : 1;
	u16_s CH2NP : 1;
	u16_s CH3EN : 1;
	u16_s CH3P : 1;
	u16_s : 2;
} timer_chctl2_s;

_Static_assert(sizeof(timer_chctl2_s) == 2,
	       "Struct timer_chctl2_s defined error!");

static inline void timer_wreg_chctl2_s(timer_qe timer_q,
				       timer_chctl2_s chctl2) {
	union {
		timer_chctl2_s c;
		u16_s u;
	} cu = {
		.c = chctl2,
	};
	timer_wreg_u16(timer_q, TIMER_CHCTL2_R, T16B_0_R, cu.u);
}
